package cn.com.open.itembank.service;

import cn.com.open.itembank.dto.QuestionModel;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by lucky on 2017/9/13.
 */

@FeignClient(name = "item-qti-service")
public interface QtiRemoteService {

    /**
     * 检查试题模型合法性.
     *
     * @param model the model
     * @return the int
     */
    @PostMapping(value = "/openqti/question/checkmodel")
    int checkQuestionModel(@RequestBody QuestionModel model);

    /**
     * 从xml转换试题模型实体.
     *
     * @param i3         the 3
     * @param needAnswer the need answer
     * @param xml        the xml
     * @return the question
     * @throws Exception the exception
     */
    @PostMapping(value = "/openqti/question/get")
    QuestionModel getQuestion(@RequestParam("i3") int i3, @RequestParam("needAnswer") boolean needAnswer, @RequestBody String xml);

    /**
     * 根据试题模型实体转换成xml.
     *
     * @param model the model
     * @return the xml
     */
    @PostMapping(value = "/openqti/question/getxml")
    String getQuestionXml(@RequestBody QuestionModel model);

    /**
     * 根据试题模型得到试题标题.
     *
     * @param model the model
     * @return the xml
     */
    @PostMapping(value = "/openqti/question/gettitle")
    String getTitle(@RequestBody QuestionModel model);
}
